<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
   <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="Bookmark" href="../favicon.ico" >
<link rel="Shortcut Icon" href="../favicon.ico" />
<link rel="stylesheet" type="text/css" href="../static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="../lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/style.css" />
    <link href="/lib/easyui/themes/default/easyui.css" rel="stylesheet" type="text/css">
    <link href="/lib/easyui/themes/icon.css" rel="stylesheet" type="text/css">
    <title>用户管理</title>
</head>
<script type="text/javascript" src="../lib/jquery/1.9.1/jquery.js"></script> 
<script type="text/javascript">
$(function(){
	$("#searchs").click(function(){
		var condition=document.getElementById("condition").value;
		var startDate=$("#datemin").val();
		var endDate=$("#datemax").val();
		condition=sel();
		var result=$("#result").val();
		$.get("/SelectPurchaseHistoryRecord",{datemin:startDate,datemax:endDate,condition:condition,result:result
		},function(data,textStatus){
			if(data!="false"){ 
				 json=$.parseJSON(data);
				$("#retable").datagrid({
			        data:json,
				});	
				$("#retable").datagrid("reload");
			}else{
				alert("未找到符合条件的数据");
			}
		});
	})
})
 function sel(){
	 var option=document.getElementById("condition").value;	
	  return option;
} 
function edit(val,row,index){
	return "<a onclick=clic("+index+")>退货</a>"
}
function clic(index){
	$("#retable").datagrid("selectRow",index);
    var row = $('#retable').datagrid('getSelected');
    if(row){
        /*弹窗创建出库单 .salesId传递到下个页面,不会阻断程序执行*/
        location.href="/ReturnOperateServlet?purId="+row.purId.toString()+"&flag="+row.executeState.toString();
    }
}
</script>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 采购 <span class="c-gray en">&gt;</span> 采购记录 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>

    <div class="page-container "  style="width:1500px;height:100%;margin:20px auto">
        <div id="datetool" style="padding: 10px">
            <input class="easyui-datebox" id="datemin" style="width: 100px"/>--
            <input class="easyui-datebox" id="datemax" style="width: 100px"/>&nbsp;&nbsp;&nbsp;
            <select id="condition" name="condition" onchange="javascript:sel()" >
   			<option value="1" selected="selected">供货商名称</option>
   			<option value="2">产品编号</option>
   			</select>
            <input  id="result" style="width: 100px"/>
            <a href="#" class="easyui-linkbutton" iconCls="icon-search" id="searchs" >查找</a>
        </div>
        <table id="retable" class="easyui-datagrid" style="width:100%;height:'auto';" title="销售单查询" striped="true"
               data-options="url:'/SelectPurchaseAppendByPages',fitColumns:true,singleSelect:true,
               pagination:true,
               toolbar:'#datetool'">
        <thead> 
		<tr>
			<th data-options="field:'pursId',width:100">采购单编号</th>
			<th data-options="field:'supName',width:100">供货商</th>
			<th data-options="field:'purchaseDate',width:100">采购日期</th>
			<th data-options="field:'operatorName',width:100,align:'right'">经办人</th>
			<th data-options="field:'docMakerName',width:100">制表人</th>
			<th data-options="field:'checkerName',width:100">验收人</th>
			<th data-options="field:'keeperName',width:100">保管人</th>
			<th data-options="field:'accountPaying',width:100,align:'right'">应付总金额</th>
			<th data-options="field:'accountPaied',width:100">实付总金额</th>
			<th data-options="field:'executeState',width:100">执行状态</th>
			<th data-options="field:'purId',width:100">从表编号</th>
			<th data-options="field:'operate',width:100,formatter:edit">操作</th>
			<!-- <th data-options="field:'proName',width:100">产品名称</th>
			<th data-options="field:'purQuantity',width:100,align:'right'">产品数量</th>
			<th data-options="field:'purPrice',width:100">产品单价</th>
			<th data-options="field:'purDiscount',width:100">产品折扣</th>
			<th data-options="field:'purTotal',width:100">产品总价</th>
			<th data-options="field:'stoName',width:100,align:'right'">进货仓库</th> -->
		</tr>
    	</thead>
	</table> 
<jsp:include page="/_footer.jsp"/>
<script type="text/javascript" src="/lib/laypage/1.2/laypage.js"></script>
<script src="/lib/easyui/jquery.easyui.min.js"></script>
<script src="/lib/easyui/dateview.js"></script>
<script src="/lib/easyui/locale/easyui-lang-zh_CN.js"></script>
</body>
</html> 
